<cfsetting enablecfoutputonly="yes">

<cfparam name="attributes.url" default="#application.xtiurl#">
<cfparam name="attributes.dtd" default="#application.xtidtd#">
<cfparam name="attributes.debug" default="false">
<cfparam name="attributes.return_false" default="0">
<cfparam name="attributes.debuglevel" default="1,2,3">
<cfparam name="attributes.customerid" default="">
<cfparam name="attributes.last_name" default="">
<cfparam name="attributes.first_name" default="">

<cfparam name="attributes.profile">

<cfif attributes.return_false>
	<cfset temp = setvariable('caller.xti_createcustomer.result', false)>
	<cfsetting enablecfoutputonly="no">
	<cfexit method="exittag">
</cfif>

<!--- Build the xml to send to middleware--->
<cfscript>
x=1;
var.profile='';
while (x lte arraylen(attributes.profile))
{
  	var.profile = var.profile & '<' & attributes.profile[x][1] & '>' & ucase(attributes.profile[x][2]) &  '</' & attributes.profile[x][1] & '>
	';
	x = x+1;
 }
 
xml = 
'<!DOCTYPE copy SYSTEM "#attributes.dtd#">
<xtiinput>
   <inputheader>
      <actionset>
         <action>upd_cust</action>
      </actionset>
   </inputheader>
   <inputdata>
	<customer>
		<customerid>#UCase(attributes.customerid)#</customerid>
		<customer_type>#UCase(attributes.customer_type)#</customer_type>
		<company_name>#UCase(replacenocase(replace(attributes.company_name, '&', 'AND' , 'ALL'), 'amp;', '', 'ALL'))#</company_name>
		<last_name>#UCase(attributes.last_name)#</last_name>
		<first_name>#UCase(attributes.first_name)#</first_name>
		#var.profile#
	</customer>
   </inputdata>
</xtiinput>';
</cfscript>